//
// Created by Lenovo on 2021/3/11.
//
#include <iostream>

void binary_search() {
    int a[] = {1, 2, 9, 20, 100, 200};
    int key;
    std::cin >> key;

    int low, high = sizeof(a) / sizeof(a[0]) - 1;
    int mid = 0;
    bool find = false;
    while (low <= high) {
        mid = (low + high) / 2;

        if (a[mid] == key) {
            find = true;
            std::cout << "find place: " << mid << std::endl;
            break;
        }

        if (a[mid] > key)
            high = mid - 1;

        if (a[mid] < key)
            low = mid + 1;
    }

    if (!find) {
        std::cout <<  "not find key" << std::endl;
    }
}

